import java.util.stream.Stream;

public class Leetcode2180 {
    public static void main(String[] args) {
        for (int i = 1; i <= 1000; i++) {
            System.out.println(countEven(i));
        }
    }


    public static int countEven(int num) {
        boolean flag = num % 2 == 0;
        int res = num / 2;

        int sum = 0;
        while (num != 0) {
            sum += num % 10;
            num /= 10;
        }

        if (sum % 2 == 0) {
            return res;
        }

        return res - (flag ? 1 : 0);
    }

    public static int countEven1(int num) {
        return (num - (Stream.iterate(num / 10, n -> n > 0, n -> n / 10).mapToInt(x -> x % 10).sum() & 1)) / 2;
    }
}
